package me.thinkjet.sso.server.authentication;

import java.util.HashMap;
import java.util.Map;

import me.thinkjet.sso.server.Credentials;
import me.thinkjet.sso.server.authentication.exception.AuthenticationException;

/**
 * 
 * @ClassName AuthenticationManager
 * @author johnny_zyc
 * @Modified 2013-3-2 下午2:47:01
 * 
 */
public class AuthenticationManager {
	public final Authentication authenticate(final Credentials credentials)
			throws AuthenticationException {
		AuthenticationHandler authenticationHandler = new AuthenticationHandler();
		try {
			if (authenticationHandler.authenticate(credentials)) {
				Map<String, Object> attributes = new HashMap<String, Object>();
				return new Authentication(credentials.getName(), attributes);
			} else {

			}
		} catch (AuthenticationException e) {
		}
		return null;
	}
}
